package cool.gaogao.test;

import org.junit.Test;
import org.springframework.context.support.GenericApplicationContext;

/**
 * @author 高山青
 * @Date 2021/12/31  -   23:22
 */
public class Genner {
	/**
	 * 把自己new的对象注入到容器中
	 */
	@Test
	public void test(){
		GenericApplicationContext genericApplicationContext=new GenericApplicationContext();
		genericApplicationContext.refresh();
		genericApplicationContext.registerBean("user1",User.class,()->new User());
		User user=(User) genericApplicationContext.getBean("user1");
		user.add();
	}

}
